package org.wwx.register;

import org.wwx.register.core.LightweightRegistry;

/**
 * @date 2025/6/6
 * @author王闻薪
 */
public class RegisterApplication {
    public static void main(String[] args) throws Exception {
        LightweightRegistry registry = new LightweightRegistry.Builder()
                .withBuiltInHttpServer(8080)
                .withHealthCheck(90) // 90秒过期
                .build();

        registry.start();

        // 添加关闭钩子
        Runtime.getRuntime().addShutdownHook(new Thread(() -> {
            try {
                registry.stop();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }));
    }
}
